﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ShareTools
{
    public partial class remoteConnect : Form
    {
        public writeLog writeLog1;
        public remoteConnect()
        {
            InitializeComponent();
        }
        public remoteConnect(writeLog writeLog)
        {
            InitializeComponent();
            this.writeLog1 = writeLog;
        }

        private void remoteConnect_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 根据IP进行远程连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            //生成远程地址
            string remoteIp = textBox2.Text;
            string remotePath = "\\\\" + remoteIp + "\\";
            string userName = "HDMA-4000";
            string passWord = "hdp";
            
            //调用远程操作类，将文件夹映射到本地
            REMOTEDIRECTORY rd1 = new REMOTEDIRECTORY();
            rd1.MapDriveECS(remotePath, userName, passWord);

            //写日志，能够成功调用
            LOG log1 = new LOG();
            this.writeLog1("创建成功，关闭");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            LOG log1 = new LOG();
            //log1.WriteToLog("创建成功，关闭");
            this.writeLog1("关闭");
            this.Close();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
